package addon.w3.mdx.com;

import java.io.IOException;
import java.util.Vector;

import addon.w3.mdx.LEDataInputStream;
import addon.w3.mdx.MDXException;
import addon.w3.mdx.MDXParentCOM;

/**
LITE						// [Light]
	long	nbytes;
	struct {
		long	nbytesi;
		OBJ
		long	Type			(0:Omnidirectional;1:Directional;2:Ambient)
		float	AttStart, AttEnd;
		float	ColR, ColG, ColB;
		float	Intensity;
		float	AmbColR, AmbColG, AmbColB;
		float	AmbIntensity;
		(KLAI)
		(KLAV)
		(KLAC)
		(KLBC)
		(KLBI)
	} lights[nlits];
 * @author madjk
 *
 */
public class MDXLight extends MDXParentCOM {
	int length = -1;
	Vector lights = null;
	
	public String getTag() {
		return "LITE";
	}
	
	public void _decode(LEDataInputStream ins) throws IOException, MDXException {
		length = ins.readInt();
		ins.skip(length);
//		int cntLength = 0;
//		lights = new Vector();
//		while(cntLength < length) {
//			MDXLightCOM mdcom = new MDXLightCOM();
//			mdcom.decode(ins);
//			lights.add(mdcom);
//			cntLength = mdcom.nbytesi;
//			//System.out.println(" cntLength : "+cntLength+ "/"+length);
//			//debug( mdcom.toString() );
//		}
//		//debug( geosets.get( (geosets.size()-1) ).toString() );
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("TAG : "+getTag());
		sb.append("\n\tELEN : "+length);
		if(lights != null && lights.size() > 0) sb.append("\n\tLITE : "+lights.size());
		return sb.toString();
	}

	@Override
	public boolean isImplicitTag() {
		// TODO Auto-generated method stub
		return true;
	}
}